-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Slashing Queue #793
feat: Slashing Queue #793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good besides comments provided. Please address and please consider pulling out the logic into separate files once we get the service-update
branch in a good state.
let own_slash = percent.mul_floor(own_stake); | ||
let others_slash = delegators | ||
.into_iter() | ||
.map(|(delegator, stake, _asset_id)| (delegator, percent.mul_floor(stake))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove knowledge of the asset when you return it? Isn't this necessary across all assets being used by the service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we currently treat them equally, i.e if the slash is 10%, then we slash every delegator's stake by the 10% regardless of the asset kind. this not ideal of course, since not all assets are equal. Until we have an interface to map everything to Native token (TNT) we can take asset kind into account.
* feat: Slashing Queue (#793) * feat: Slashing Queue * feat: Per Service restaking percentage exposure * test: add more tests for the unapplied slash * feat: slashing precompile (#795) * feat: slashing precompile * feat: Slashing and Dispute precompiles * Update subxt * test: add more tests to cover more cases * doc: Update internal functions docs * chore: Update toml formatting * lint: fix clippy * chore: update tangle-subxt version --------- Co-authored-by: shekohex <[email protected]>
Summary of changes
Changes introduced in this pull request:
This pull request includes several significant changes to the
pallets/multi-asset-delegation
andpallets/services
modules, focusing on adding new functionalities, refining existing ones, and removing deprecated features.New Functionalities:
get_delegators_for_operator
method inMultiAssetDelegationInfo
trait to retrieve delegators for a given operator. (pallets/multi-asset-delegation/src/traits.rs
)SlashDeferDuration
andSlashOrigin
types for managing slashing actions and deferring slashes. (pallets/services/src/lib.rs
)UnappliedSlash
event and storage for managing unapplied slashes. (pallets/services/src/lib.rs
) [1] [2]Refinements:
approve
method to include arestaking_percent
parameter, allowing operators to specify the percentage of restaked tokens exposed to the service. (pallets/services/src/lib.rs
)request
method to simplify the process and removed the approval preference logic. (pallets/services/src/lib.rs
) [1] [2] [3]Removals:
update_approval_preference
method and related event, as well as deprecated theServiceRequestUpdated
event. (pallets/services/src/lib.rs
) [1] [2] [3]Minor Changes:
approval
field fromOperatorPreferences
struct. (pallets/services/src/benchmarking.rs
)sp_runtime::Percent
import for percentage calculations. (pallets/services/src/lib.rs
)These changes collectively enhance the flexibility and functionality of the modules, while also cleaning up outdated code.
Reference issue to close (if applicable)
Closes #775